ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Rabbit_Base Class Reference

#include <Rabbit.h>

Inheritance diagram for Rabbit_Base:
TAnimal TALMaSSObject Rabbit_Adult Rabbit_Young Rabbit_Female Rabbit_Male Rabbit_Juvenile

Public Member Functions

TTypeOfRabbitState GetCurrentRState ()
 
void SetAge (int a_age)
 Set age method. More...
 
RabbitObjectTypes GetRabbitType (void)
 Get rabbit type. More...
 
int GetAge (void)
 Get age method. More...
 
void SetweightAge (int a_age)
 Set age method. More...
 
int GetweightAge (void)
 Get age method. More...
 
Rabbit_WarrenGetWarren (void)
 Get warren pointer. More...
 
void SetWarren (Rabbit_Warren *a_warren)
 Set the warren pointer. More...
 
bool GetHasBurrow (void)
 Get burrow status. More...
 
void SetHasBurrow (bool a_status)
 Set/unset burrow status. More...
 
void SetDigging (int a_days)
 Set number of days to dig. More...
 
int GetDigging ()
 Get number of days to dig. More...
 
APoint GetBornLocation ()
 Get location of birth. More...
 
 Rabbit_Base (int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
 Rabbit constructor. More...
 
virtual ~Rabbit_Base (void)
 Rabbit destructor. More...
 
virtual void BeginStep (void)
 The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
virtual void Step (void)
 The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'. More...
 
virtual void EndStep (void)
 The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep. More...
 
void OnFed (void)
 Signals food arrived today. More...
 
void OnMumDead (void)
 Signals death of mum. More...
 
void OnEvicted (void)
 Signals mum has a new litter to look after. More...
 
virtual Rabbit_AdultGetMate (void)
 Get mate pointer. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Public Attributes

RabbitObjectTypes m_RabbitType
 The rabbits type. More...
 

Static Public Attributes

static double m_dispersalmortperm = cfg_dispersalmortperm.value()
 The extra dispersal mortality per m travelled. More...
 
static double m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value()
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 

Protected Member Functions

virtual void Explore (void)
 Exploration method. More...
 
virtual void st_Dying (void)
 Default dying state. More...
 
bool MortalityTest (double a_prop)
 A simple probability based test. More...
 
bool WalkTo (int a_x, int a_y)
 Walks to a location from current location. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
virtual void GeneralEndocrineDisruptor (double)
 Handles internal effects of endocrine distrupter pesticide exposure.
More...
 
virtual void GeneralOrganoPhosphate (double)
 Handles internal effects of organophosphate pesticide exposure. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

int m_Age
 The rabbit's age. More...
 
TTypeOfRabbitState m_CurrentRState
 Variable to record current behavioural state. More...
 
Rabbit_Population_Managerm_OurPopulationManager
 This is a time saving pointer to the correct population manager object. More...
 
double m_MyMortChance
 
bool m_haveBurrow
 Flag to record burrow status. More...
 
Rabbit_Warrenm_myWarren
 True if currently mated. More...
 
Rabbit_Femalem_Mum
 Pointer to mum. More...
 
bool m_FedToday
 Flag for been fed today. More...
 
double m_weight
 The weight in g. More...
 
int m_weightAge
 A physiological age parameter, this is the growth age based on an optimal curve (if optimal conditions it will be the same as m_age) More...
 
int m_digging
 Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries to make one. More...
 
APoint m_born_location
 The x,y location at birth. More...
 
double m_pesticide_burden
 State variable used to hold the current body-burden of pesticide. More...
 
bool m_pesticideInfluenced1
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth).
More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Constructor & Destructor Documentation

◆ Rabbit_Base()

Rabbit_Base::Rabbit_Base ( int  p_x,
int  p_y,
int  p_x2,
int  p_y2,
Landscape p_L,
Rabbit_Population_Manager p_NPM,
Rabbit_Warren a_warren 
)

Rabbit constructor.

161  : TAnimal(p_x, p_y, p_L)
162 {
163  // Assign the pointer to the population manager
164  m_OurPopulationManager = p_NPM;
166  m_haveBurrow = false;
167  m_myWarren = a_warren;
168  m_born_location.m_x = p_x2;
169  m_born_location.m_y = p_y2;
170  if (m_myWarren != NULL) m_myWarren->Join(this);
171  m_pesticideInfluenced1 = false;
172  m_pesticide_burden = 0.0;
173 }
@ toRabbits_InitialState
Definition: Rabbit.h:84
int m_y
Definition: ALMaSS_Setup.h:56
int m_x
Definition: ALMaSS_Setup.h:55
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Rabbit.h:203
APoint m_born_location
The x,y location at birth.
Definition: Rabbit.h:201
bool m_haveBurrow
Flag to record burrow status.
Definition: Rabbit.h:185
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Rabbit.h:205
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
void Join(Rabbit_Base *a_rabbit)
Adds this rabbit to the warren list.
Definition: Rabbit.cpp:2061
TAnimal(int x, int y, Landscape *L)
Definition: PopulationManager.cpp:1367

References Rabbit_Warren::Join(), m_born_location, m_CurrentRState, m_haveBurrow, m_myWarren, m_OurPopulationManager, m_pesticide_burden, m_pesticideInfluenced1, APoint::m_x, APoint::m_y, and toRabbits_InitialState.

◆ ~Rabbit_Base()

Rabbit_Base::~Rabbit_Base ( void  )
virtual

Rabbit destructor.

177 {
178  if (m_myWarren != NULL ) m_myWarren->Leave(this);
179 }
void Leave(Rabbit_Base *a_rabbit)
Remove this adult from the warren list.
Definition: Rabbit.cpp:2117

References Rabbit_Warren::Leave(), and m_myWarren.

Member Function Documentation

◆ BeginStep()

void Rabbit_Base::BeginStep ( void  )
virtual

The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per timestep.

Reimplemented from TAnimal.

182  {
184 }
CfgBool cfg_RabbitUseNatalDispersalRecord
CfgInt cfg_RabbitUseNatalDispersalRecordAge
bool value(void)
Definition: configurator.h:135
int value(void)
Definition: configurator.h:98
int m_Age
The rabbit's age.
Definition: Rabbit.h:177
void NatalDispersalRecordOutput(Rabbit_Base *a_rabbit)
Records the natal dispersal.
Definition: Rabbit_Population_Manager.cpp:912

References cfg_RabbitUseNatalDispersalRecord, cfg_RabbitUseNatalDispersalRecordAge, m_Age, m_OurPopulationManager, Rabbit_Population_Manager::NatalDispersalRecordOutput(), CfgInt::value(), and CfgBool::value().

Referenced by Rabbit_Young::BeingStep().

◆ EndStep()

virtual void Rabbit_Base::EndStep ( void  )
inlinevirtual

The EndStep is the third 'part' of the timestep that an animal can behave in. It is called once per timestep.

Reimplemented from TAnimal.

Reimplemented in Rabbit_Adult, Rabbit_Juvenile, and Rabbit_Young.

272  {
273  ;
274  }

◆ Explore()

virtual void Rabbit_Base::Explore ( void  )
inlineprotectedvirtual

Exploration method.

293  {
294  ;
295  }

◆ GeneralEndocrineDisruptor()

virtual void Rabbit_Base::GeneralEndocrineDisruptor ( double  )
inlineprotectedvirtual

Handles internal effects of endocrine distrupter pesticide exposure.

Reimplemented in Rabbit_Female.

307  {
308  ;
309  }

◆ GeneralOrganoPhosphate()

void Rabbit_Base::GeneralOrganoPhosphate ( double  )
protectedvirtual

Handles internal effects of organophosphate pesticide exposure.

1438  {
1439  //if (g_rand_uni() > l_pest_daily_mort.value()) return;
1442  m_StepDone = true;
1443  return;
1444 }
@ toRabbits_Die
Definition: Rabbit.h:96
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
Definition: Rabbit_Population_Manager.cpp:768
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118

References m_CurrentRState, m_OurPopulationManager, m_RabbitType, TALMaSSObject::m_StepDone, Rabbit_Population_Manager::PesticideDeathRecord(), and toRabbits_Die.

Referenced by Rabbit_Juvenile::InternalPesticideHandlingAndResponse(), Rabbit_Male::InternalPesticideHandlingAndResponse(), and Rabbit_Female::InternalPesticideHandlingAndResponse().

◆ GetAge()

int Rabbit_Base::GetAge ( void  )
inline

Get age method.

222  {
223  return m_Age;
224  }

References m_Age.

Referenced by Rabbit_Population_Manager::ReproOutputRecordOutput().

◆ GetBornLocation()

APoint Rabbit_Base::GetBornLocation ( )
inline

Get location of birth.

258  {
259  return m_born_location;
260  }

References m_born_location.

Referenced by Rabbit_Population_Manager::NatalDispersalRecordOutput().

◆ GetCurrentRState()

TTypeOfRabbitState Rabbit_Base::GetCurrentRState ( )
inline

DEBUG method to get the current state

210  {
211  return m_CurrentRState;
212  }

References m_CurrentRState.

Referenced by Rabbit_Warren::Leave().

◆ GetDigging()

int Rabbit_Base::GetDigging ( )
inline

Get number of days to dig.

254  {
255  return m_digging;
256  }
int m_digging
Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries t...
Definition: Rabbit.h:199

References m_digging.

Referenced by Rabbit_Warren::JoinNMate(), Rabbit_Warren::Leave(), and Rabbit_Warren::Mate().

◆ GetHasBurrow()

bool Rabbit_Base::GetHasBurrow ( void  )
inline

Get burrow status.

242  {
243  return m_haveBurrow;
244  }

References m_haveBurrow.

Referenced by Rabbit_Adult::EndStep(), Rabbit_Warren::JoinNMate(), Rabbit_Warren::Leave(), and Rabbit_Warren::Mate().

◆ GetMate()

virtual Rabbit_Adult* Rabbit_Base::GetMate ( void  )
inlinevirtual

Get mate pointer.

Reimplemented in Rabbit_Adult.

288  {
289  return NULL;
290  };

Referenced by Rabbit_Warren::Leave().

◆ GetRabbitType()

RabbitObjectTypes Rabbit_Base::GetRabbitType ( void  )
inline

Get rabbit type.

218  {
219  return m_RabbitType;
220  }

References m_RabbitType.

Referenced by Rabbit_Warren::Leave(), Rabbit_Population_Manager::NatalDispersalRecordOutput(), and Rabbit_Adult::SetMate().

◆ GetWarren()

Rabbit_Warren* Rabbit_Base::GetWarren ( void  )
inline

Get warren pointer.

234  {
235  return m_myWarren;
236  }

References m_myWarren.

◆ GetweightAge()

int Rabbit_Base::GetweightAge ( void  )
inline

Get age method.

230  {
231  return m_weightAge;
232  }
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197

References m_weightAge.

Referenced by Rabbit_Warren::ChooseNewDominant().

◆ InternalPesticideHandlingAndResponse()

virtual void Rabbit_Base::InternalPesticideHandlingAndResponse ( )
inlineprotectedvirtual

Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

Reimplemented in Rabbit_Female, Rabbit_Male, and Rabbit_Juvenile.

303  {
304  ;
305  }

Referenced by Rabbit_Adult::EndStep().

◆ MortalityTest()

bool Rabbit_Base::MortalityTest ( double  a_prop)
inlineprotected

A simple probability based test.

Parameters
[in]a_propmust be between 0 and <1.0 This is a simple probability test.
195 {
200  if (g_rand_uni() < a_prop) return true;
201  else return false;
202 }
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni

References g_rand_uni.

Referenced by Rabbit_Juvenile::EndStep(), Rabbit_Adult::EndStep(), and Rabbit_Young::st_Develop().

◆ OnEvicted()

void Rabbit_Base::OnEvicted ( void  )
inline

Signals mum has a new litter to look after.

284  {
286  }
@ toRabbits_Weaning
Definition: Rabbit.h:91
Rabbit_Female * m_Mum
Pointer to mum.
Definition: Rabbit.h:191

References m_CurrentRState, m_Mum, and toRabbits_Weaning.

Referenced by Rabbit_Female::st_GiveBirth().

◆ OnFed()

void Rabbit_Base::OnFed ( void  )
inline

Signals food arrived today.

276  {
277  m_FedToday = true;
278  }
bool m_FedToday
Flag for been fed today.
Definition: Rabbit.h:193

References m_FedToday.

Referenced by Rabbit_Female::st_Lactating().

◆ OnMumDead()

void Rabbit_Base::OnMumDead ( void  )
inline

Signals death of mum.

280  {
281  m_Mum = NULL;
282  }

References m_Mum.

Referenced by Rabbit_Female::st_Dying().

◆ SetAge()

void Rabbit_Base::SetAge ( int  a_age)
inline

Set age method.

214  {
215  m_Age = a_age;
216  }

References m_Age.

◆ SetDigging()

◆ SetHasBurrow()

◆ SetWarren()

void Rabbit_Base::SetWarren ( Rabbit_Warren a_warren)
inline

Set the warren pointer.

238  {
239  m_myWarren = a_warren;
240  }

References m_myWarren.

Referenced by Rabbit_Warren::Join(), and Rabbit_Warren::Leave().

◆ SetweightAge()

void Rabbit_Base::SetweightAge ( int  a_age)
inline

Set age method.

226  {
227  m_weightAge = a_age;
228  }

References m_weightAge.

◆ st_Dying()

void Rabbit_Base::st_Dying ( void  )
protectedvirtual

Default dying state.

Reimplemented in Rabbit_Female, Rabbit_Adult, Rabbit_Juvenile, and Rabbit_Young.

188 {
189  m_CurrentStateNo = -1; // this will kill the animal object and free up space
190  m_StepDone = true;
191 }
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116

References TALMaSSObject::m_CurrentStateNo, and TALMaSSObject::m_StepDone.

Referenced by WalkTo().

◆ Step()

virtual void Rabbit_Base::Step ( void  )
inlinevirtual

The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously until all animals report that they are 'DONE'.

Reimplemented from TAnimal.

Reimplemented in Rabbit_Female, Rabbit_Male, Rabbit_Juvenile, and Rabbit_Young.

268  {
269  ;
270  }

◆ WalkTo()

bool Rabbit_Base::WalkTo ( int  a_x,
int  a_y 
)
protected

Walks to a location from current location.

Parameters
[in]a_xx-coordinate to move to
[in]a_yy-coordinate to move to
Returns
True if the rabbit still lives, otherwise false if it was killed in dispersal.

Assumes a rectangluar distance movement with associated probability of mortality by distance.

206 {
214  int dist = abs(a_x-m_Location_x) + abs(a_y-m_Location_y);
215  double prob = dist * m_dispersalmortperm;
216  m_Location_x = a_x;
217  m_Location_y = a_y;
218  if (g_rand_uni() > prob) return true;
219  else
220  {
221  st_Dying();
222  g_counter++;
223  return false;
224  }
225 }
int g_counter
Definition: Rabbit.cpp:76
static double m_dispersalmortperm
The extra dispersal mortality per m travelled.
Definition: Rabbit.h:172
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:187
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225

References g_counter, g_rand_uni, m_dispersalmortperm, TAnimal::m_Location_x, TAnimal::m_Location_y, and st_Dying().

Referenced by Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

Member Data Documentation

◆ m_Age

◆ m_born_location

APoint Rabbit_Base::m_born_location
protected

◆ m_CurrentRState

◆ m_digging

int Rabbit_Base::m_digging
protected

Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries to make one.

Referenced by Rabbit_Adult::EndStep(), GetDigging(), Rabbit_Adult::Rabbit_Adult(), SetDigging(), Rabbit_Male::st_EvaluateTerritory(), and Rabbit_Female::st_EvaluateTerritory().

◆ m_dispersalmortperm

double Rabbit_Base::m_dispersalmortperm = cfg_dispersalmortperm.value()
static

◆ m_FedToday

bool Rabbit_Base::m_FedToday
protected

◆ m_haveBurrow

bool Rabbit_Base::m_haveBurrow
protected

Flag to record burrow status.

Referenced by GetHasBurrow(), Rabbit_Base(), SetHasBurrow(), and Rabbit_Male::st_EvaluateTerritory().

◆ m_Mum

◆ m_MyMortChance

double Rabbit_Base::m_MyMortChance
protected

◆ m_myWarren

◆ m_OurPopulationManager

◆ m_pesticide_burden

◆ m_pesticidedegradationrate

double Rabbit_Base::m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value()
static

◆ m_pesticideInfluenced1

bool Rabbit_Base::m_pesticideInfluenced1
protected

Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth).

Referenced by Rabbit_Female::GeneralEndocrineDisruptor(), Rabbit_Base(), and Rabbit_Female::st_GiveBirth().

◆ m_RabbitType

◆ m_weight

◆ m_weightAge

int Rabbit_Base::m_weightAge
protected

The documentation for this class was generated from the following files: